package com.wn.class30.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/** 
* @author 周豪 E-mail: 
* @version 创建时间：2020年3月7日 下午4:37:41 
* 类说明 :swagger2 spring 配置注入
*/
@Configuration
public class SwaggerConfig {
	@Bean
	public Docket createRestApi() {
		//API构建器
		ApiInfoBuilder apiBuilder = new ApiInfoBuilder();
		//设置API的相关信息
		apiBuilder.title("微信公众号系统");
		apiBuilder.description("微信公众号系统");
		apiBuilder.contact("GG");
		apiBuilder.version("1.0");
		//构建API对象
		ApiInfo api = apiBuilder.build();
		//构建API清单 用于说明那些接口需要生成API文档
		Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(api);
		//定义接口（控制层）所在的包
	docket.select().apis(RequestHandlerSelectors.basePackage("com.wn.class30.controller")).paths(PathSelectors.any()).build();
		return docket;
	}
}
